package mysql

import "gorm.io/gorm"

type Browse struct {
	gorm.Model
	LookNum   int     `gorm:"type:int;comment:浏览量"`
	BuyerNum  int     `gorm:"type:int;comment:买家数"`
	Money     float64 `gorm:"type:decimal(10,2);comment:成交金额"`
	Name      string  `gorm:"type:varchar(30);comment:用户名称"`
	ClassName string  `gorm:"type:varchar(30);comment:用户购买的课程名称"`
	Num       int     `gorm:"type:int;comment:参与人数"`
	Talk      string  `gorm:"type:varchar(50);comment:活动效果"`
}

func (Browse) TableName() string {
	return "browse"
}

func (b *Browse) Find() (result []Browse, err error) {
	err = DB.Find(&result).Error
	if err != nil {
		return nil, err
	}
	return result, nil
}
